using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{

    protected void btnTransfer_Click(object sender, EventArgs e)
    {
        Server.Transfer("Default2.aspx");
    }

    protected void btnInsideUpdatePanel_Click(object sender, EventArgs e)
    {
        lbl.Text = "I am inside update panel and I was compressed! I'm impressed!";
    }

    protected void btnRedirectInsideUpdatePanel_Click(object sender, EventArgs e)
    {
        Response.Redirect("DEfault2.aspx");
    }

    

    protected void btnNormalPage_Click(object sender, EventArgs e)
    {
        
    }
    protected void btnNormalPageExcel_Click(object sender, EventArgs e)
    {
        Response.Clear();
        Response.ClearHeaders();
        Response.AppendHeader("content-disposition", "attachment;filename=Orders_" + DateTime.Now.ToString("dd-MM-yyyy") + ".xls");

        Response.Charset = "";
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.Cache.SetNoServerCaching();
        Response.Cache.SetNoStore();
        Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
        Response.ContentType = "application/ms-excel";
        Response.Write("<html><body>Hello</body></html>");
        Response.End();
    }
    protected void btnRedirect_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default2.aspx");
    }
    protected void btnNormalPageEnd_Click(object sender, EventArgs e)
    {
        Response.Clear();
        Response.ClearHeaders();
        Response.ContentType = "text/html";
        Response.Write("Normal page with Response.End()");
        Response.End();
    }
    protected void btnExcelEnd_Click(object sender, EventArgs e)
    {
        Response.Clear();
        Response.ClearHeaders();
        Response.AppendHeader("content-disposition", "attachment;filename=Orders_" + DateTime.Now.ToString("dd-MM-yyyy") + ".xls");

        Response.Charset = "";
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.Cache.SetNoServerCaching();
        Response.Cache.SetNoStore();
        Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
        Response.ContentType = "application/ms-excel";
        Response.Write("<html><body>Hello</body></html>");
        Response.Flush();
        Response.End();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        throw new ApplicationException("Test exception");
    }
}
